package com.recruit.common.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.recruit.common.dto.logo.CreateOrUpdateLogoDTO;
import com.recruit.common.mapper.LogoMapper;
import com.recruit.common.model.LogoDO;
import com.recruit.common.service.LogoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  LOGO-服务实现类
 * </p>
 *
 * @author Eval
 * @since 2022-04-04
 */
@Service
public class LogoServiceImpl extends ServiceImpl<LogoMapper, LogoDO> implements LogoService {

    @Resource
    private LogoMapper logoMapper;

    @Override
    public boolean createLogo(CreateOrUpdateLogoDTO validator) {
        LogoDO  logoDO = new LogoDO();
        logoDO.setNo(validator.getNo());
        logoDO.setUrl(validator.getUrl());
        return logoMapper.insert(logoDO) > 0;
    }

    @Override
    public boolean updateLogo(LogoDO logoDO, CreateOrUpdateLogoDTO validator) {
        logoDO.setNo(validator.getNo());
        logoDO.setUrl(validator.getUrl());
        return logoMapper.updateById(logoDO) > 0;
    }

    @Override
    public boolean deleteById(Integer id) {
        return logoMapper.deleteById(id) > 0;
    }

    @Override
    public List<LogoDO> getAll() {
        return logoMapper.selectList(null);
    }

    @Override
    public List<LogoDO> show() {
        return logoMapper.show();
    }
}
